package com.myidis.servlet;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.myidis.entity.QuotaType;
import com.myidis.mapper.QuotaTypeMapper;

@Service
public class QuotaTypeServlet {
	@Autowired
	private QuotaTypeMapper quotaTypeMapper;
	
	public List<QuotaType> all() { 
		return quotaTypeMapper.all();
	}
	
	public QuotaType getOne(int id) {
		return quotaTypeMapper.getOne(id);
	}
	
	public int insert(QuotaType obj) {
		return quotaTypeMapper.insert(obj);
	}
	
	public int insertAll(List<QuotaType> objs) {
		int count = 0;
		for (QuotaType obj: objs) {
			count += quotaTypeMapper.insert(obj);
		}
		return count;
	}
	
	public int update(QuotaType quotaType) {
		return quotaTypeMapper.update(quotaType);
	}
	
	public int delete(int id) {
		return quotaTypeMapper.delete(id);
	}
	
	public int deleteAll(int[] ids) {
		int count = 0;
		for(int id: ids)
			count += quotaTypeMapper.delete(id);
		return count;
	}
}
